package com.gba.mark.user.mapper.permission;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gba.mark.user.entity.permission.Role;
import com.gba.mark.user.entity.permission.SysRole;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper extends BaseMapper<SysRole> {
    /**
     * 根据用户id获取角色
     * @param userId 用户id
     * @return
     */
    @Select("SELECT r.id, r.name FROM user_role u, role r WHERE u.user_id = #{userId} AND u.role_id = r.id")
    List<Role> selectRoleByUserId(@Param("userId") Integer userId);
}
